<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<title>卡拉卡-在线选号平台</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<link href="css/win.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="../js/jquery.cookie.js"></script>
		<script type="text/javascript" src="../js/logon.js"></script>
		<script type="text/javascript" src="../js/jquery.blockUI.js"></script>
		<script type="text/javascript" src="../js/jquery.dateFormat-1.0.js"></script>
		<script language="javascript" type="text/javascript">
			$(document).ready(function () {
			$.ajax({    
			        type:'post',
			        url:'/home/stat',
			        data:{},
			        cache:false,
			        async:false,
			        dataType:'json',
			        success:function(data){
			        	if(data!="error")
			        	{
			        		$("#total").text(data.total);
			        		$("#mcount").text(data.mobile);
			        		$("#ucount").text(data.unicom);
			        		$("#monthCount").text(data.month);
			        	}
			        },
			        error: function(){  //失败
				        alert('Error loading document');
				    }
			    });
			});
			
			function detail(obj,pack)
			{
				$.ajax({    
			        type:'post',
			        url:'/order/detail',
			        data:{oid:obj},
			        cache:false,
			        async:false,
			        dataType:'json',
			        success:function(data){
			        	if(data=="error")
			        	{
			        		alert(data);
			        	}
			        	else
			        	{
			        		var orderTime = new Date();
			        		orderTime.setTime(data.order_time);
			        		var id_exp_date=new Date();
			        		id_exp_date.setTime(data.id_exp_date);
			        		$("#order_time").text($.format.date(orderTime,"yyyy/MM/dd HH:mm"));
			        		$("#storeName").text(data.name);
			        		$("#s_account").text(data.s_account);
			        		var ct=data.card_type==1?"芯1":data.card_type==2?"芯2":"其它";
			        		$("#phone").text(data.phone+"("+ct+")");
			        		var cn=data.carrier==1?"中国移动":data.carrier==2?"中国联通":"中国移动";
			        		var bra=data.brand==10?"全球通":data.brand==11?"动感地带":data.brand==12?"神州行":data.brand==20?"沃3G":data.brand==21?"如意通":data.brand==22?"特区行":data.brand==23?"新势力":"其它";
			        		$("#carrierName").text(cn+"("+bra+")");
			        		$("#package").text(pack);
			        		$("#tariff_type").text(data.tariff_type==1?"立即生效":data.tariff_type==2?"套餐减半":data.traiff_type==3?"下月生效":"无");
			        		$("#account_name").text(data.account_name);
			        		$("#id_exp_date").text($.format.date(id_exp_date,"yyyy/MM/dd"));
			        		$("#tel").text(data.tel);
			        		$("#id_number").text(data.id_number);
			        		$("#id_address").text(data.id_address);
			        		$("#c_address").text(data.c_address);
			        		if(data.status)
			        		{
			        			if(data.status==1)
			        			{
			        				$("#status").html("<span style=\"color:red\"><b>待开卡</b></span>");
			        				$("input[name=result][value=2]").attr("checked",true);
			        			}
			        			else if(data.status==2)
			        			{
			        				$("#status").html("<span style=\"color:green\"><b>已开卡</b></span>");
			        				$("input[name=result][value=2]").attr("checked",true);
			        			}
			        			else if(data.status==3)
			        			{
			        				$("#status").html("<span style=\"color:blue\"><b>已撤单</b></span>");
			        			}
			        			else if(data.status==4)
			        			{
			        				$("#status").html("<span style=\"color:red\"><b>已驳回</b></span>");
			        				$("input[name=result][value=4]").attr("checked",true);
			        			}
			        		}
			        		$("#remark").val(data.remark);
			        		$("#iccid").text("订单详情");
							if(data.iccid && data.iccid != "")
							{
								$("#iccid").text("订单详情 (ICCID="+data.iccid+")");
							}
							$.blockUI({ message: $('#pop')});
			        	}
			        },
			        error: function(){  //失败
				        alert('Error loading document');
				    }
			    });  
			}
			
			function hide()
			{
				$.unblockUI();
			}
		</script>
		
	</head>

	<body>
		<!--首先设置一个层:-->
		<div id="pop" class="pop" style="display:none">
			<div class="pop_body">
				<div class="pop_title" id="iccid">订单详情</div>
				<table width="100%" border="0" cellspacing="0" cellpadding="6" class="pop_table">
					<tr>
						<td width="18%" align="center" valign="top" class="line">定单时间：</td>
						<td class="line" id="order_time"></td>
						<td width="18%" class="line">门店：</td>
						<td class="line" id="storeName"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">工号：</td>
						<td class="line" id="s_account"></td>
						<td class="line">订购号码：</td>
						<td class="line" id="phone"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">运营商：</td>
						<td class="line" id="carrierName"></td>
						<td class="line">套餐内容：</td>
						<td class="line" id="package"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">当月资费方式：</td>
						<td class="line" id="tariff_type"></td>
						<td class="line">开户姓名：</td>
						<td class="line" id="account_name"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">证件号码：</td>
						<td class="line" id="id_number"></td>
						<td class="line">证件有效期：</td>
						<td class="line" id="id_exp_date"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">证件地址：</td>
						<td class="line" id="id_address"></td>
						<td class="line">联系电话：</td>
						<td class="line" id="tel"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">联系地址：</td>
						<td class="line" id="c_address"></td>
						<td class="line">订单状态：</td>
						<td class="line" id="status"></td>
					</tr>
					<tr>
						<td align="center" valign="top" class="line">操作结果：</td>
						<td class="line"><input type="radio" name="result" value="2" checked/>开卡&nbsp;&nbsp;<input type="radio" name="result" value="4"/>驳回订单</td>
						<td class="line">处理意见：</td>
						<td class="line"><input type="text" id="remark" name="remark" style="border:#999 1px solid;" maxlength="128"/></td>
					</tr>

					<tr>
						<td colspan="4" align="center" class="td_n">
							<input type="submit" name="Submit" value="关闭" class="login_btn" onclick="hide();" />
						</td>
					</tr>
				</table>
			</div>
		</div>

		#include("header.html")
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="content">
			<tr><td valign="top" id="menu">
			#include("menu_admin.html")
			</td>
			<td id="right">
				<div id="user">
					<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="50%" style="background: url(images/line.png) right center no-repeat;">
								<table width="100%" border="0" cellspacing="0" cellpadding="3">
									<tr>
										<td width="110" rowspan="5" align="center">
											<img src="images/user.png" width="78" height="78" />
										</td>
										<td>操作员：$!{model.get("user").name}</td>
									</tr>
									<tr>
										<td>工号：$!{model.get("user").account}</td>
									</tr>
									<tr>
										<td>上次登录：$!date.format('yyyy/MM/dd HH:mm',$!{model.get("user").last_login_time})</td>
									</tr>
									<tr>
										<td>
											<form id="logonform" name="logonform" action="" method="post">
											<input type="button" name="modpwd" value="修改密码" class="change_btn" onclick="pwd();" />
											<input type="button" name="exit" value="退出" class="out_btn" onclick="logout();"/>
											</form>
										</td>
									</tr>
								</table>
							</td>
							<td align="center">
								<table border="0" cellspacing="0" cellpadding="5">
									<tr>
										<td>今日完成订单数：<span id="total" class="green big">0</span> 笔</td>
									</tr>
									<tr>
										<td>其中移动号码：<span id="mcount" class="green">0</span> 个 联通号码：<span id="ucount" class="green">0</span> 个</td>
									</tr>
									<tr>
										<td>本月订单合计：<span id="monthCount" class="green">0</span> 个</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</div>
				<div id="list">
					<div class="title">
						<span>近期订单记录</span><a href="/sale/order">更多记录&gt;&gt;</a>
					</div>
					<div class="data">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							#foreach( $!{order} in $!model.get("list") )
							<tr>
								<td width="110">$!date.format('yyyy/MM/dd HH:mm',$!{order.order_time})</td>
								<td width="120">$!{order.name}</td>
								<td width="30">$!{order.s_account}</td>
								<td class="num16" width="100">$!{order.phone.substring(0,7)}<span class="orange">$!{order.phone.substring(7)}</span></td>
								<td width="110">
									#if($!{order.carrier} == 1)
									<img src="images/icon_mobile.png" />
									#elseif($!{order.carrier}==2)
									<img src="images/icon_unicom.png" />
									#end
									$!{model.get("packages").get($order.package_).name}
								</td>
								<td width="40">#if($!{order.status}==1)待开卡#elseif($!{order.status}==2)已开卡#elseif($!{order.status}==3)已撤单#elseif($!{order.status}==4)已驳回#end</td>
								<td>$!{order.remark}</td>
								<td width="40"><a href="javascript:void(0);" onclick="detail($!{order.oid},'$!{model.get("packages").get($order.package_).name}');">详情&gt;</a></td>
							</tr>
							#end
							#set($size = 9-$!model.get("list").size())
							#if($size > 0)
							#set($nums=[1..$size])
							#foreach($i in $nums)
							<tr>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
							</tr>
							#end
							#end
						</table>
					</div>
				</div>
		</td></tr></table>
		#include("footer.html")
	</body>
</html>
